package com.AAL.Action;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class managerOrder extends ActionSupport {	
	public final class ListYear {
		private String myKey;
		private String myValue;		
		public ListYear(String k, String name){
			this.myKey = k;
			this.myValue = name;
		}
		public String getMyKey() {
			return myKey;
		}
		public void setMyKey(String myKey) {
			this.myKey = myKey;
		}
		public String getMyValue() {
			return myValue;
		}
		public void setMyValue(String myValue) {
			this.myValue = myValue;
		}

	}
	private Map<String, Float> dataMap;	
	private List<ListYear> listYears;
	private String year;	
	private ArrayList<Integer> arrayList;
	
	public ArrayList<Integer> getArrayList() {
		return arrayList;
	}
	public void setArrayList(ArrayList<Integer> arrayList) {
		this.arrayList = arrayList;
	}	
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
	public List<ListYear> getListYears() {
		return listYears;
	}
	public void setListYears(List<ListYear> listYears) {
		this.listYears = listYears;
	}
	public Map<String, Float> getDataMap() {
		return dataMap;
	}
	public void setDataMap(Map<String, Float> dataMap) {
		this.dataMap = dataMap;
	}
	public String execute() {
		listYears = new ArrayList<ListYear>();		
		listYears.add(new ListYear("0", "2000"));
		listYears.add(new ListYear("1", "2001"));
		listYears.add(new ListYear("2", "2002"));
		System.out.println("aaaaaaa:"+year);
		if (year!=null && year.equalsIgnoreCase("0")) {
		
			System.out.println("0");
		} else if(year!=null && year.equalsIgnoreCase("1")) {
			
			System.out.println("1");
		}
		else{
		
			System.out.println("2 "+year);
		}
		dataMap = new HashMap<String, Float>();
		dataMap.put("Xe du lịch", 45.0f);
		dataMap.put("Xe thể thao", 26.8f);
		dataMap.put("Xe tải", 8.5f);
		arrayList = new ArrayList<Integer>();		
		for(int i=0;i<12;i++){		
			arrayList.add(i, 200);
		}
		return SUCCESS;
    }
	public String viewMyOrderList() {
		try {
			listYears = new ArrayList<ListYear>();		
			listYears.add(new ListYear("0", "2000"));
			listYears.add(new ListYear("1", "2001"));
			listYears.add(new ListYear("2", "2002"));
			System.out.println("aaaaaaa:"+year);
			if (year!=null && year.equalsIgnoreCase("0")) {
			
				System.out.println("0");
			} else if(year!=null && year.equalsIgnoreCase("1")) {
				
				System.out.println("1");
			}
			else{
			
				System.out.println("2 "+year);
			}
			dataMap = new HashMap<String, Float>();
			dataMap.put("Xe du lịch", 45.0f);
			dataMap.put("Xe thể thao", 26.8f);
			dataMap.put("Xe tải", 8.5f);
			arrayList = new ArrayList<Integer>();		
			for(int i=0;i<12;i++){		
				arrayList.add(i, 200);
			}

		} catch (Exception e) {
			return ERROR;
		}
		return SUCCESS;
		
	}

}
